package com.lagou.rpc.consumer.controller;

import com.alibaba.fastjson.JSON;
import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private IUserService userService;

    @RequestMapping("/getById")
    public String getById(){
        User user =userService.getById(1);
        return JSON.toJSONString(user);
    }

    @RequestMapping("/getByName")
    public String getByName(){
        User user =userService.getByName("abc");
        return JSON.toJSONString(user);
    }
}
